﻿<h3><span style="color: #666;">今日團購：</span>{$value['title']}</h3>
    	<div id="buy917_product_show">
        	<div class="adblock">
                <div class="imgbox"></div>
                <ul class="showbox"></ul>
                <div class="btnlink" title="0"></div>
            </div>
        </div><!-- buy917_product_show -->
        <div id="buy917_product_count">
        	<div id="buy917_price">
              <div class="top">
              	<h3>$ {$value['shop_price']}</h3>
              	<div class="btn">
                	{if $value['stock']<=$value['group_buynum']} 
                      <span class="deal-price-soldout"></span>
                    {elseif $timestamp>$value['group_end_time']} 
                       <span class="deal-price-expire"></span> 
                    {else}
                      <span><a href="buy.php?gid={$value['gid']}"><img src="{TPL}images/buy_btn.png" /></a> </span>
                    {/if}
                </div>
                <div class="under">
                	<table width="95%" border="0" cellpadding="2" cellspacing="0">
                          <tr>
                            <th>原　價</th>
                            <th class="discont">折　扣</th>
                            <th class="province">節　省</th>
                          </tr>
                          <tr>
                            <td align="center"><strike>${echo $value['market_price']} </strike></td>
                            <td align="center" class="discont">{php $pic=($value['shop_price']*10/$value['market_price']); echo sprintf("%1.1f",$pic)}折</td>
                            <td align="center" class="province">${php $pic1=($value['market_price']-$value['shop_price']); echo $pic1}</td>
                          </tr>
                    </table>
                 </div>
              </div>
            </div><!-- preice -->
            
						
			
            {if $value['stock']<=$value['group_buynum']}
            <div id="buy917_date">
                <div diff="0" id="deal-timeleft" class="deal-box deal-timeleft deal-off">
                  <h3>本團購結束於</h3>
                    <div class="limitdate" style="background:none;">
                        <p class="deal-buy-ended" style="width:280px; margin-left:-40px; margin-top:6px;">20{date("y年m月d日", $value['group_end_time'])}--
						{date("H點i分", $value['group_end_time'])}</p>
                    </div>
                </div>
            </div><!-- date -->
            
            <div id="buy917_timer">
                <div id="deal-status" class="deal-box deal-status deal-status-soldout">
                  <div class="deal-buy-soldout"></div>
                  <p class="deal-buy-tip-total">共有 <strong>{$value['group_buynum']}</strong>人購買</p>
                </div>
            </div><!--timer -->
            {elseif $timestamp>$value['group_end_time']}
                {if $value['group_usernum']>$value['group_buynum']}
                <div id="buy917_date">
                    <div class="deal-box deal-status deal-status-open" id="deal-status">
                      <div class="deal-buy-expired-fail"></div>
                    </div>
                </div><!-- date -->    
                {else}
                 <div id="buy917_date">
                    <div diff="0" id="deal-timeleft" class="deal-box deal-timeleft deal-off">
                      <h3>本團購結束於</h3>
                    <div class="limitdate" style="background:none;">
                        <p class="deal-buy-ended" style="width:280px; margin-left:-40px; margin-top:6px;">20{date("y年m月d日", $value['group_end_time'])}--
						{date("H點i分", $value['group_end_time'])}</p>
                    </div>
                    </div>
                 </div><!--timer -->  
                  <div id="buy917_timer"> 
                    <div id="deal-status" class="deal-box deal-status deal-status-istipped">
                      <div class="deal-buy-expired-succ"></div>
                      <p class="deal-buy-tip-total">共有 <strong>{$value['group_buynum']}</strong> 人購買</p>
                    </div>
                  </div><!--timer -->  
                 {/if}                        
            {else}
            <div id="buy917_date">
                  <h3>剩餘時間</h3>
                  <div class="limitdate">
                    <script type="text/javascript">
                        var sysSecond = parseInt('{echo $value["group_end_time"]-$timestamp}');
                        var interValObj = window.setInterval(setRemainTime, 1000); 
                        function setRemainTime()
                        {
                            if (sysSecond > 0)
                            {
                                sysSecond -= 1;
                                var second = Math.floor(sysSecond % 60);              // 計算秒     
                                var minite = Math.floor((sysSecond / 60) % 60);       //計算分
                                var hour = Math.floor((sysSecond / 3600) % 24);       //計算小時
                                var day = Math.floor((sysSecond / 3600) / 24);        //計算天
                                var timeHtml = "<li><span>"+hour+"</span><small>小時</small></li><li><span>"+minite+"</span><small>分</small></li>";
                                if(day > 0)
                                    timeHtml ="<li><span>"+day+"</span><small>天</small></li>" + timeHtml;
                                
                                timeHtml+="<li><span>"+second+"</span><small>秒</small></li>";
                                
                                try
                                {
                                    $("#counter").html(timeHtml);
                                }
                                catch(e){}}
                            else
                            {
                                window.clearInterval(interValObj);}
                        }
                        </script>
                    <ul id="counter"></ul>
                  </div>
            </div><!-- date -->
            {if $value['group_usernum']<=$value['group_buynum']}
              <div id="buy917_timer">
                    <div class="deal-box deal-status deal-status-open" id="deal-status">
                      <p class="deal-buy-tip-top"><strong>{$value['group_buynum']}</strong><span title="" closure_uid_ueavjb="54" se="人已購買" te="人已購買">人已購買</span></p>
                      <p class="deal-buy-tip-notice">數量有限，下單要快喲</p>
                      <p class="deal-buy-on">團購已成功，<br />
                        可繼續購買&hellip;</p>
                      <p class="deal-buy-tip-btm">{date("H點i分", $value['group_success_time'])}達到最低團購人數：<strong>{$value['group_usernum']}</strong> 人</p>
                </div>
               </div> 
      		 {else}
              <div id="buy917_timer">
                <div class="deal-box deal-status deal-status-open" id="deal-status">
                  <p class="deal-buy-tip-top"><strong>{$value['group_buynum']}</strong> 人已購買</p>
                  <p class="deal-buy-tip-notice">數量有限，先搶先贏</p>
                  <div style="width:194px; margin:0 auto; border:solid 1px #bee284; padding:0 30px; background:#f8fadf;">
                      <div style="padding-left: {echo ($value['group_buynum'])*186/$value['group_usernum']}px;" class="progress-pointer"><span></span></div>
                      <div class="progress-bar">
                        <div style="width:{echo ($value['group_buynum'])*186/$value['group_usernum']}px" class="progress-left"></div>
                        <div class="progress-right "></div>
                      </div>
                      <div class="cf">
                        <div class="min">0</div>
                        <div class="max">{$value['group_usernum']}</div>
                      </div>
                   </div>   
                  <p class="deal-buy-tip-btm">還差 <strong>{echo $value['group_usernum']-$value['group_buynum']}</strong> 人到達最低團購人數</p>
                </div>
              </div><!--timer -->
            {/if}   
           {/if}
            
        </div><!-- buy917_time -->